<template>
    <div class="app-container">

        <div class="contract-page">
            <div class="contract-top">
                <div class="contract-navlist">
                    <div @click="handleQuery(1, item.value)" v-for="(item, index) in navlist" :key="index"
                        class="contract-nav flex-center" :class="(type == item.value ? 'on' : '') + (' nav_on' + index)">
                        {{ item.name }}
                    </div>
                </div>

              <!--  <div @click="handleQuery" class="refresh-btn flex-center">
                    刷新
                </div> -->
            </div>
            <div class="contract-list">
                <div class="item" v-for="(item, index) in contractList" :key="index" >
                    <div class="item-top">
                        <div class="left">
                            <b> {{ item.companyName }}</b>
                            <span>{{ item.orgName }}</span>
                        </div>
                        <div class="right">
                            合作期限：{{ item.beginDate }}~ {{ item.endDate }}
                        </div>
                    </div>
                    <div class="item-cont">

                        <div v-for="(itemChild, indexChild) in item.list" :key="indexChild" class="ul-link">
                            <span>
                              {{ itemChild.fileName }}
                            </span>
                        </div>


                        <div class="tips nav_on4" v-if="item.statusType==0">已作废</div>
						<div class="tips nav_on1" v-if="item.statusType==1">已生效</div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</template>

<script setup name="Company">
import { userListContract } from "@/api/company/contract";

const { proxy } = getCurrentInstance();

const contractList = ref([]);
const loading = ref(true);
const total = ref(0);
// const navlist = ref([]);
const type = ref(0);


const data = reactive({

    navlist: [
        {
            name: '全部',
            value: 0,
        }
		// ,
  //       {
  //           name: '已生效',
  //           value: 1,
  //       },
  //       {
  //           name: '未生效',
  //           value: 2,
  //       },
  //       {
  //           name: '已失效',
  //           value: 3,
  //       },
  //       {
  //           name: '已作废',
  //           value: 4,
  //       },
  //       {
  //           name: '即将过期',
  //           value: 5,
  //       }
    ],
    form: {}, // 基本详情
    queryParams: {
        pageNum: 1,
        pageSize: 10,

    }
});

const { queryParams, form, navlist } = toRefs(data);

/** 查询公司信息列表 */
function getList() {
    loading.value = true;
    userListContract(queryParams.value).then(response => {
        contractList.value = response.data;
        // total.value = Number(response.total);
        loading.value = false;
    });
}



/** 搜索按钮操作 */
function handleQuery(type = 0, value = 0) {
    if (type == 1) {
        type.value = value || 0;
    }
    queryParams.value.pageNum = 1;
    getList();
}


getList();
</script>

<style lang="scss" scoped>
.app-container {
    padding: 20px;
    background: rgb(244, 247, 252);
}

.contract-page {
    width: 100%;
    background-color: #fff;
    padding: 20px;

    .contract-top {
        width: 100%;
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        border-bottom: 1px solid #e8e8e8;

        .contract-navlist {
            display: flex;
            align-items: flex-end;


            .contract-nav {
                width: 96px;
                height: 40px;
                line-height: 40px;
                margin-right: 10px;
                position: relative;
                padding-top: 5px;
                font-size: 14px;

                &::after {
                    content: '';
                    position: absolute;
                    top: 0;
                    left: 0;
                    height: 4px;
                    width: 100%;
                    background: transparent;
                }

                &.nav_on0 {
                    background-color: #e4efff;
                    color: #135afa;

                    &.on {
                        &::after {
                            background: #135afa;
                        }
                    }
                }

                &.nav_on1 {
                    background-color: #e4fcf7;
                    color: #12c3b1;

                    &.on {
                        &::after {
                            background: #12c3b1;
                        }
                    }
                }

                &.nav_on2 {
                    background-color: #fff3f0;
                    color: #ee4e41;

                    &.on {
                        &::after {
                            background: #ee4e41;
                        }
                    }
                }

                &.nav_on3 {
                    background-color: #f4f7fc;
                    color: #87919d;

                    &.on {
                        &::after {
                            background: #87919d;
                        }
                    }
                }

                &.nav_on4 {
                    background-color: #e3e5e7;
                    color: #87919d;

                    &.on {
                        &::after {
                            background: #87919d;
                        }
                    }
                }

                &.nav_on5 {
                    background-color: #fff7e4;
                    color: #f7ba1e;

                    &.on {
                        &::after {
                            background: #f7ba1e;
                        }
                    }
                }


            }

        }

        .refresh-btn {
            width: 82px;
            height: 32px;
            line-height: 32px;
            border: 1px solid rgba(0, 0, 0, 0.2);
            margin-bottom: 2px;
            font-size: 12px;
        }
    }


    .contract-list {
        width: 100%;

        .item {
            width: 100%;
            margin-top: 20px;
            box-shadow: 0 3px 6px 1px rgba(0, 0, 0, .05);

            .item-top {
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: space-between;
                background-color: #f5f9ff;
                padding: 10px 28px;
                position: relative;

                &:before {
                    position: absolute;
                    content: "";
                    left: 0;
                    top: 0;
                    height: 100%;
                    width: 4px;
                    background-color: #FF6201;
                }

                .left {
                    display: flex;
                    align-items: center;
                    line-height: 1.5;

                    b {
                        font-size: 18px;
                        color: #FF6201;
                    }

                    span {
                        color: #87919d;
                        margin-left: 20px;
                        font-size: 14px;
                    }
                }

                .right {
                    color: #87919d;
                    font-size: 14px;
                }
            }

            .item-cont {
                width: 100%;
                position: relative;
                padding-bottom: 24px;
                overflow: hidden;


                .ul-link {
                    padding: 16px 0;
                    margin: 0 24px;
                    border-bottom: 1px solid #e4efff;
                    width: 90%;
                    font-size: 14px;
                }


                .tips {
                    position: absolute;
                    height: 40px;
                    line-height: 40px;
                    text-align: center;
                    right: -60px;
                    bottom: 15px;
                    width: 200px;
                    transform: rotate(-45deg);
                    font-size: 18px;

                    &.nav_on0 {
                        background-color: #e4efff;
                        color: #135afa;


                    }

                    &.nav_on1 {
                        background-color: #e4fcf7;
                        color: #12c3b1;


                    }

                    &.nav_on2 {
                        background-color: #fff3f0;
                        color: #ee4e41;


                    }

                    &.nav_on3 {
                        background-color: #f4f7fc;
                        color: #87919d;


                    }

                    &.nav_on4 {
                        background-color: #e3e5e7;
                        color: #87919d;


                    }

                    &.nav_on5 {
                        background-color: #fff7e4;
                        color: #f7ba1e;


                    }

                }

            }

        }

    }

}
</style>
